package com.nervenets.web.redis.domain.user;

import com.nervenets.web.enumeration.WealthType;
import com.nervenets.web.redis.RedisOrderedSetDomain;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 累计获得的总金额排行
 * Created by Joe on 2018/1/25.
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class WealthOfTotalMoney extends RedisOrderedSetDomain {
    private long userId;
    private WealthType wealthType;
    private long money;

    public WealthOfTotalMoney(long userId, WealthType wealthType) {
        this.userId = userId;
        this.wealthType = wealthType;
    }

    @Override
    public double getOrderedValue() {
        return money;
    }

    @Override
    public String getField() {
        return String.valueOf(userId);
    }

    @Override
    public String getKey() {
        return String.format("WEALTH_OF_TOTAL_%s", wealthType.getName().toUpperCase());
    }
}
